import Axios from '@/utils/request'
import {getResult} from '@/api/util'

const SHARE = `https://debug.yasee.com.cn/`

/**
 * 获取我的页面接口
 * @author 李代弟
 * @Date 2023-10-07 13：54
 */
//获取个人信息
export function getUserInfo(data) {
    return Axios({
        url: `/admin/user/queryUserInformation`,
        method: 'get',
        // headers: {
        //     'Authorization': data.token
        // }
    })
}

export function editUserInfo(obj) {
    return Axios({
        url: '/admin/user/appEdit',
        method: 'put',
        data: obj
    })
}

export function chargePassword(obj) {
    return Axios({
        url: '/admin/user/chargePassword',
        method: 'post',
        data: obj
    })
}

//获赞 朋友 关注 粉丝的数
export function queryStatisticalInfo(data) {
    return Axios({
        url: '/cms/yaseeContentStatistics/queryStatisticalInfo',
        method: 'post',
        data: data,
        // headers: {
        //     'Authorization': data.token
        // }
    })
}

export function getInfoQuery(data) {
    return Axios({
        url: '/cms/yaseeContent/personalInfoQuery',
        method: 'post',
        data: data,
        // headers: {
        //     'Authorization': data.token
        // }
    })
}

//隐私和用户协议
export function getAgreement(data) {
    return Axios({
        url: `/admin/agreement/getAgreement/${data.amType}/${data.language}`,
        method: 'get',
    })
}

//检测新版本
export function checkUpdate(data) {
    return Axios({
        url: `/admin/appVersion/checkUpdate/${data.sysType}/${data.versionCode}`,
        method: 'get',
    })
}

//意见反馈
export function getFeedback(data) {
    return Axios({
        url: '/admin/feedback',
        method: 'post',
        data: data,
    })
}

//注销账户
export function removeUser(data) {
    return Axios({
        url: '/admin/user/userRemove',
        method: 'post',
        data: data,
    })
}

//==================================地址管理=====================
export function queryAddress(data) { //查询
    return Axios({
        url: `/shop/yaseeUserAddress/queryAddress`,
        method: 'get',
        params: data
    })
}

export function deleteAddress(data) { //删除
    return Axios({
        url: `/shop/yaseeUserAddress/deleteUserAddress/${data.id}`,
        method: 'delete',
    })
}

export function addAddress(data) { //新增或修改
    return Axios({
        url: '/shop/yaseeUserAddress/addUserAddress',
        method: 'post',
        data: data,
    })
}

export function getFanFollowList(data) { //新增或修改
    return Axios({
        url: '/cms/yaseeContentStatistics/friendFanFollowList',
        method: 'post',
        data: data,
    })
}

//========================检测人管理(增删改查)=============================
//查询检测人列表
export function queryTesterList(data) { //查询
    return Axios({
        url: `/admin/sysUserInspector/queryTesterList`,
        method: 'get',
    })
}

export function modifyUserBy(obj) { //修改
    return Axios({
        url: '/admin/sysUserInspector/modifyUserBy',
        method: 'put',
        data: obj
    })
}

export function newTester(data) { //新增
    return Axios({
        url: '/admin/sysUserInspector/newTester',
        method: 'post',
        data: data,
    })
}

export function deleteTester(data) { //删除
    return Axios({
        url: `/admin/sysUserInspector/deleteTester/${data.id}`,
        method: 'delete',
    })
}



//字典查询关系
export function getFriendList(data) {
    return Axios({
        url: '/admin/dict/type/friend_label',
        method: 'get',
    })
}

//是否吸烟
export function getSmokingList(data) {
    return Axios({
        url: '/admin/dict/type/smoking_type',
        method: 'get',
    })
}

//是否饮酒
export function getDrinkingList() {
    return Axios({
        url: '/admin/dict/type/drink_type',
        method: 'get',
    })
}

//性别
export function getGenderList(data) {
    return Axios({
        url: '/admin/dict/type/gender',
        method: 'get',
    })
}

//饮食习惯
export function getFoodType(data) { //主食偏好
    return Axios({
        url: '/admin/dict/type/staple_food_type',
        method: 'get',
    })
}

export function getTasteType(data) {
    return Axios({
        url: '/admin/dict/type/taste_type', //口味偏好
        method: 'get',
    })
}

export function getDinnerType(data) {
    return Axios({
        url: '/admin/dict/type/dinner_type', // 每日餐次类型
        method: 'get',
    })
}

export function getSprotList(data) {
    return Axios({
        url: '/admin/dict/type/exercise_type',
        method: 'get'
    })
}

// 检测人手机号验证
export function testTesterPhone(data) {
    return Axios({
        url: '/admin/register/registerPhone',
        method: 'post',
        data: data,
    })
}

// 通过id查询检测人信息
export function getTesterById(query) {
    return Axios({
        url: `/admin/sysUserInspector/${query.id}`,
        method: 'get',
        // params:query
    })
}
//-------------------------------健康档案-----------------------------
export function queryHealthRecord(data) { //查询或者修改 家族遗传史，生活习惯
    return Axios({
        url: '/admin/sysUserHealthRecord/queryHealthRecord',
        method: 'get',
    })
}

export function saveHealthRecord(data) { //保存或者修改 家族遗传史，生活习惯
    return Axios({
        url: '/admin/sysUserHealthRecord/save',
        method: 'post',
        data: data,
    })
}

export function addMedical(data) { //添加医疗记录
    return Axios({
        url: '/admin/sysMedicalRecord/addMedical',
        method: 'post',
        data: data,
    })
}

export function deleteMedicalRecord(data) { //删除
    return Axios({
        url: `/admin/sysMedicalRecord/deleteMedicalRecord`,
        method: 'delete',
        params: data
    })
}

//添加医疗记录
export function addSysMedicalRecond(data) {
    return Axios({
        url: `/admin/sysMedicalRecord`,
        method: 'post',
        data: data
    })
}

//查询测量数据
export function getTestHealthData(data) { //删除
    return Axios({
        url: `/bio/testData/heather`,
        method: 'get',
        headers: {
            'tenant-id': 1
        }
    })
}

//========================添加好友(取关，互关，移除等接口)=========================
export function attention(data) {
    return Axios({
        url: `/cms/yaseeAuthorLikeDetail/addAuthorLike/${data.id}`,
        method: 'get',
    })
}

export function removeFriends(data) { //移除
    return Axios({
        url: `/cms/yaseeAuthorLikeDetail/removeFriends/${data.id}`,
        method: 'get',
    })
}


export function removeFans(data) { //移除粉丝
    return Axios({
        url: `/cms/yaseeAuthorLikeDetail/removeFans/${data.id}`,
        method: 'get',
    })
}

// =============================新增需求 亲友管理================================
//获取验证码
export function rlsmsCode(mobile) {
    return Axios({
        url: '/admin/mobile/registerOrLogin/' + mobile,
        method: 'get'
    })
}

// 亲友标签
export function friendList() {
    return Axios({
        url: '/admin/dict/type/friend_label',
        method: 'get',
    })
}

// 更换手机号
export function newTestPhone(data) { //新增
    return Axios({
        url: '/admin/user/chargeUsername',
        method: 'post',
        data: data,
    })
}

// 更改备注
export function saveNote(data) {
    return Axios({
        url: '/cms/yaseeAuthorLikeDetail/saveNote',
        method: 'post',
        data: data,
    })
}

//亲友列表
export function getFamilyFriendList(data) {
    return Axios({
        url: '/admin/yaseeUserFrind/page',
        method: "get",
    })
}

//验证亲友手机短信验证码
export function checkSmsCode(data) {
    return Axios({
        url: '/admin/yaseeUserFrind/check/phone',
        method: "get",
        params: data
    })
}


//新增、修改亲友保存接口
export function addByPhone(data) {
    return Axios({
        url: '/admin/yaseeUserFrind/addByPhone',
        method: 'post',
        data: data,
    })
}

//获取用户主绑设备
export function getMasterDevice(data) {
    return Axios({
        url: '/admin/yaseeUserFrind/getMasterDevice',
        method: "get",
        params: data
    })
}

//移除亲友关系
export function deleteFamilyFriend(data) {
    return Axios({
        url: `/admin/yaseeUserFrind/delete/${data.id}`,
        method: "delete",
    })
}

// 我的二维码

// 判断是否为好友
export function testIsFriend(data) {
    return Axios({
        url: '/admin/yaseeUserFrind/query/isFriend',
        method: "get",
        params: data
    })
}

// 添加好友

export function saveByQRCode(data) { //新增
    return Axios({
        url: '/admin/yaseeUserFrind/saveByQRCode',
        method: 'post',
        data: data,
    })
}

// 亲友更换手机号获取验证码
export function familySmsCode(mobile) {
    return Axios({
        url: '/admin/yaseeUserFrind/checkAddSendSms/' + mobile,
        method: 'get'
    })
}

// 新增检测人手机号获取验证码
export function testSmsCode(mobile) {
    return Axios({
        url: '/admin/sysUserInspector/checkTesterSendSms/' + mobile,
        method: 'get'
    })
}

// 设置更换手机号获取验证码
export function userSmsCode(mobile) {
    return Axios({
        url: '/admin/user/checkChargeUsernameSendSms/' + mobile,
        method: 'get'
    })
}